<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="expires" content="-1" />
	<link rel="stylesheet" type="text/css" href="/site_media/css/style.css" />
	<script type="text/javascript" src="/site_media/js/script.js"></script>
	<title>Labmin - grupy usług</title>
</head>
<body>
	<div id="wrap">
		{% include "header.html" %}
		{% if request.session.user %}
			<div id="content-wrap">
				{% include "sidebar.html" %}
				<div id="main">
					<div class="box">
                		<h1>Grupy <span class="gray">usług</span></h1>
					</div>
					<div class="padded_box">
						<input class="button" type="button" value="Pokaż wszystkie" onclick="window.location='/service_groups_list?show=all'">
						<input class="button" type="button" value="Pokaż tylko moje" onclick="window.location='/service_groups_list'">
					</div>
                	
                    {% include "pagination.html" %}
					
                    <div class="box">
						<form name="form" action="/delete_service_group" method="post">
						<input type="hidden" id="service_group_pk_input" name="service_group_pk" value="" />
                        <table class="list_table">
                        {% for service_group in objects.object_list %}
							<script type="text/javascript">
								function showServicesOfGroup{{ service_group.pk }}() {
									setSpanDescription('show_hide_group_{{ service_group.pk }}', "Ukryj usługi");
									clearAndShowDiv('services_of_group{{ service_group.pk }}');
                                	{% for service in service_group.services.all %}
									addServiceToDiv('services_of_group{{ service_group.pk }}', {{ service.pk }}, '{{ service.name }}', '{{ service.description }}')
									{% endfor %}
									surroundItemsWithULTag('services_of_group{{ service_group.pk }}');
								}
								function hideServicesOfGroup{{ service_group.pk }}() {
									setSpanDescription('show_hide_group_{{ service_group.pk }}', "Pokaż usługi");
									hideDiv('services_of_group{{ service_group.pk }}');
								}
								function switchShowAndHideServicesOfGroup{{ service_group.pk }}() {
									if (document.getElementById('show_hide_group_{{ service_group.pk }}').innerHTML == "Pokaż usługi") {
										showServicesOfGroup{{ service_group.pk }}();
									} else {
										hideServicesOfGroup{{ service_group.pk }}();
									}
								}
							</script>
						
							<tr>
                                <td><a href="show_service_group/{{ service_group.pk }}"><b>{{ service_group.name }}</b></a></td>
								<td>{{ service_group.description }}</td>
								<td><a href="#" onclick="switchShowAndHideServicesOfGroup{{ service_group.pk }}()"><span id="show_hide_group_{{ service_group.pk }}">Pokaż usługi</span></a></td>
								<td><a href="service_group_form/{{ service_group.pk }}">Edytuj</a></td>
								<td><a href="#" onclick="setHiddenValueAndSubmit('service_group_pk_input', '{{service_group.pk}}')">Usuń</a></td>
							</tr>
							<tr>
								<td colspan="5"><div id="services_of_group{{ service_group.pk }}" class="box" style="display:none"></div></td>
							</tr>
                        {% endfor %}
                        </table>
                    </div>
                    
                    {% include "pagination.html" %}
					
				</div>
			</div>
		{%endif%}
	</div>
	{% include "footer.html" %}
</body>
</html>
